// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.

const {ipcRenderer,remote} = require('electron')

if(remote){

    window.XRemote = {
        invoke: async (url,request)=>{
            let ret = await ipcRenderer.invoke(url,request);
            console.log(url,ret);
            return ret;  
        }
    }

    window.getViewRect = ()=>{
        let client = document.querySelector('#pageView');
        let rect = client.getBoundingClientRect();
        return {x:rect.x,y:rect.y,width:rect.width,height:rect.height};
    }
}
